home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
4889
/
4889.xpi
/
chrome
/
picnik.jar
/
content
/
domtweak.js
< prev
next >
Wrap
Text File
|
2007-07-30
|
4KB
|
102 lines
var picnikDOMTweak = {
onLoad:function()
{
var e = document.getElementById("appcontent");
if(e)
addEventListener("DOMContentLoaded", function(ev) { picnikDOMTweak.domLoaded(ev);}, false);
},
/***************************************************************/
/* GreaseMonkey-style DOM editing */
/* Fired every time some DOM finises loading */
domLoaded:function(e)
{
href = e.target.location.href;
for each (var site in this.tweakList)
{
if( site[0] instanceof RegExp )
{
if( href.search(site[0]) != -1 )
site[1](e.target)
}
else
{
if( site[0](e.target) )
site[1](e.target)
}
}
},
/* Flickr photo pages */
tweakFlickr: function(e)
{
var links
links = e.getElementById('button_bar');
if (!links)
{
return;
}
else
{
var photoEditURL = picnikCommon.baseURL+"?import="+escape(e.location.href);
// images URLs -- images aren't data-ized as FF doesn't like the crazy escaping when attempting to trigger the over/down states
var picnikButtonURLup = "chrome://picnik/content/picnik_grey.gif";
var picnikButtonURLover = "chrome://picnik/content/picnik_color.gif";
var picnikButtonURLdown = "chrome://picnik/content/picnik_color_down.gif";
// crate the new HTML element
var picbutton = e.createElement("href");
picbutton.innerHTML = "<a target=_blank href="+photoEditURL+" onMouseOver=\"document.picnikButton.src='"+ picnikButtonURLover +"'\" onMouseOut=\"document.picnikButton.src='"+ picnikButtonURLup +"'\" onMouseDown=\"document.picnikButton.src='"+ picnikButtonURLdown +"'\" onMouseUp=\"document.picnikButton.src='"+ picnikButtonURLover +"'\" style='outline: none;'><img src=" + picnikButtonURLup +" name='picnikButton' title='Edit this photo with Picnik' alt='Edit with Picnik' width='56' height='24'/></a>";
// append it at the end of the button_bar list
links.appendChild(picbutton);
}
},
/* Sites we know how to do GM like things to */
tweakList:[
[/flickr\.com\/photos\/.*/g, function(e){picnikDOMTweak.tweakFlickr(e)} ]
/* [picnik_smugmug_check, picnik_smugmug] */
]
};
window.addEventListener("load", function(e) { picnikDOMTweak.onLoad(e); }, false);
/*
function picnik_smugmug_check(e)
{
return e.getElementById('smugmug')!=null
}
function picnik_smugmug(e)
{
var links
links = e.getElementById('imageInfo');
if (!links)
{
return;
}
else
{
var photoEditURL = "javascript:void(window.location.href='"+picnikCommon.baseURL+"?import='+escape(document.getElementById(\"mainImage\").src))";
// images URLs -- images aren't data-ized as FF doesn't like the crazy escaping when attempting to trigger the over/down states
var picnikButtonURLup = "chrome://picnik/content/picnik_grey.gif";
var picnikButtonURLover = "chrome://picnik/content/picnik_color.gif";
var picnikButtonURLdown = "chrome://picnik/content/picnik_color_down.gif";
// crate the new HTML element
var picbutton = e.createElement("href");
picbutton.innerHTML = "<a href="+photoEditURL+" onMouseOver=\"document.picnikButton.src='"+ picnikButtonURLover +"'\" onMouseOut=\"document.picnikButton.src='"+ picnikButtonURLup +"'\" onMouseDown=\"document.picnikButton.src='"+ picnikButtonURLdown +"'\" onMouseUp=\"document.picnikButton.src='"+ picnikButtonURLover +"'\" style='outline: none;'><img src=" + picnikButtonURLup +" name='picnikButton' title='Edit this photo with Picnik' alt='Edit with Picnik' width='56' height='24'/></a>";
// append it at the end of the button_bar list
links.appendChild(picbutton);
}
}
*/